/////////////////////////////////////////////////////////////
// ast_main.h
/////////////////////////////////////////////////////////////
#pragma once

typedef struct _recv_msg
{
   _recv_msg()
    {
        memset( mMsg, 0, 1024 );
        mMsgLen    = 0;
        mThreadId = 0;
    };
    char      mMsg[1024];
    int       mMsgLen;
    pthread_t mThreadId;
   
    struct _recv_msg &operator=(const struct _recv_msg & aOther)
    {
        memset(mMsg, 0, 1024);
        memcpy(mMsg,  aOther.mMsg,  aOther.mMsgLen);
        mMsgLen    =  aOther.mMsgLen;
        mThreadId =  aOther.mThreadId;
        return * this;
    };
    int operator==(const struct _recv_msg & aOther)
    {
        if( mMsgLen ==  aOther.mMsgLen )
        {
            if( !memcmp(mMsg,  aOther.mMsg, mMsgLen ) )
                return 1;
        }
        return 0;
    };
} RECVMSG;

typedef struct _request_sock
{
   _request_sock()
    {
        mThreadId  = 0;
        mAcptSockfd = 0;
        memset( &mCliAddr, 0, sizeof( struct sockaddr_in ) );
    };

    struct sockaddr_in mCliAddr;
    int                mAcptSockfd;
    pthread_t          mThreadId;

    struct _request_sock &operator=(
                 const struct _request_sock & aOther)
    {
        memcpy( &mCliAddr,
                &aOther.mCliAddr,
                sizeof(struct sockaddr_in) );
        mAcptSockfd = aOther.mAcptSockfd;
        mThreadId= aOther.mThreadId;
        return * this;
    };
} REQUESTSOCK;

int sendCommand( char * aArgv, ... );
int run_ami_server( int aThreadMode );
int stop_ami_server();

/////////////////////////////////////////////////////////////
